package com.ruoyi.web.controller.tool;

import com.alibaba.druid.filter.config.ConfigTools;

public class DruidUtils {

    public static String encrypt(String password) throws Exception {

        String privateKey = "MIIBVgIBADANBgkqhkiG9w0BAQEFAASCAUAwggE8AgEAAkEAtewlsVdcTJOvMzR0aS9B4Jnn1sG4mIxXXeT6drMGCkgl7keMflVN/TqZ7QdKctMXm/zHXbl6STYWEb4AFnUeNQIDAQABAkEAk8M2LmAF0REXeeC+OP0wZey8OVvpwsYi5Fnq8eShIFFwRlFDT7lYRMcOZv9K09yAYokBfm6s/hOBNJvpRAoiNQIhAOd7qSPYqJ87wWFh7IsBs2swULAt+asBGRmqFsBsrIm3AiEAyTC4XHSxt8qtQ/XRYkbb0Grgd71BUfWPeRuNMWFKx3MCIQDXeqdyNOaSg3959TvKEiVALFOQDNwSMQ16dHiFWyQpdQIhAIknGneE4eZeV7HdsSjjD1TMl0tpjE8YLP+tpZpFLho7AiA7oZoYrSCnVwhvCZpvqenZvXymiyCW1rvE7F61mykPiA==";

        return ConfigTools.encrypt(privateKey,password);
    }

    public static String decrypt(String password) throws Exception{

        String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALXsJbFXXEyTrzM0dGkvQeCZ59bBuJiMV13k+nazBgpIJe5HjH5VTf06me0HSnLTF5v8x125ekk2FhG+ABZ1HjUCAwEAAQ==";

        return ConfigTools.decrypt(publicKey,password);

    }

    //public static void main(String[] args) throws Exception {
    //    System.out.println(decrypt("BBj3NyCYvx70vqkplqhPy0NIfeHsrScTvLSt38PqdhHNRGZRNmEOgsbiVG7pi8wLPIiEF2b0/POhr3cLF4GfZQ=="));
    //    System.out.println(encrypt("Wuliu@147963"));
    //}

}
